import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import autoprefixer from 'autoprefixer'
import tailwindcss from 'tailwindcss'
import { join } from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  // 软链接
  resolve: {
    alias: {
      '@': join(__dirname, '/src'),
      '@constants': join(__dirname, '/src/constants'),
      '@utils': join(__dirname, '/src/utils'),
      '@apis': join(__dirname, '/src/apis'),
    },
  },
  css: {
    postcss: {
      plugins: [autoprefixer, tailwindcss],
    },
    preprocessorOptions: {
      scss: {
        api: 'modern-compiler', // 或 "modern"，"legacy"
      },
    },
  },
  server: {
    proxy: {
      '/api': {
        target: 'https://api.imooc-front.lgdsunday.club',
        // target: 'http://127.0.0.1:3000',
        changeOrigin: true,
      },
    },
  },
})
